const mongoose = require('../db.js');
const {maxDeviceNum} = require('../../serverOpt.js');

let userSchema = new mongoose.Schema({
    userName: {
        type: String,    //数据类型
        required: true,  //是否必传
        index: { unique: true }    //是否唯一,并且加索引
    },
    userPass: {
        type: Object,
        required: true//,  //是否必传
    },
    maxDeviceNum:Number,
    parent: { type: mongoose.Schema.Types.ObjectId, ref: 'userMod' }, // 引用父账号
    userLevel: Number,//0是不开代理,1是开一级代理,2是开二级代理,以此类推
    beiZhu: String,
    checkStatus: Boolean,//是否审核通过
    permissionList: mongoose.Schema.Types.Mixed, // 存储菜单结构的字段
    createTime: String,//加入时间
})


let userMod = mongoose.model('user', userSchema) 

module.exports = userMod;

